<template>
  <el-container>
    <el-aside>
      <el-scrollbar height="100%">
        <div class="bigBox">
          <div class="top">
            <img src="../../assets/images/表头厂标.png" alt="" />
            <span>光明管理平台</span>
          </div>
          <!-- 头像 -->
          <el-col :span="12">
            <div class="block">
              <el-avatar
                :size="50"
                src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
              ></el-avatar>
              <p>用户名</p>
              <p class="i2">岗位</p>
            </div>
          </el-col>
        </div>
        <!-- 侧边菜单 -->
        <el-row class="tac">
          <el-col :span="24">
            <el-menu
              default-active="/index"
              class="el-menu-vertical-demo"
              @open="1, 2, 3, 4, 5"
              @close="1, 2, 3, 4, 5"
              background-color="linear-gradient(to right, #005f7c, #232f62)"
              text-color="#fff"
              active-text-color="#00ADFF"
              :router="true"
            >
              <el-menu-item index="/index">
                <el-icon :size="22"><home-filled /></el-icon>

                <span>主页</span>
              </el-menu-item>
              <!-- 商品 -->
              <el-sub-menu index="1">
                <template #title>
                  <el-icon :size="22"><grid /></el-icon>
                  <span>商品</span>
                </template>
                <el-menu-item index="/index/commodity">商品管理</el-menu-item>
                <el-menu-item index="/index/evaluation">评价数据</el-menu-item>
              </el-sub-menu>
              <!-- 订单 -->
              <el-sub-menu index="2">
                <template #title>
                  <el-icon :size="22"><tickets /></el-icon>
                  <span>订单</span>
                </template>
                <el-menu-item index="/index/order">订单信息</el-menu-item>
                <el-menu-item index="/index/sale">销售额</el-menu-item>
              </el-sub-menu>
              <!-- 办公 -->
              <el-sub-menu index="3">
                <template #title>
                  <el-icon :size="22"><bell-filled /></el-icon>
                  <span>办公</span>
                </template>
                <el-menu-item index="/index/group">群组列表</el-menu-item>
                <el-menu-item index="/index/address">通讯录</el-menu-item>
                <el-menu-item index="/index/file">文件信息</el-menu-item>
              </el-sub-menu>
              <!-- 个人账户 -->
              <el-sub-menu index="4">
                <template #title>
                  <el-icon :size="22"><user-filled /></el-icon>
                  <span>个人账户</span>
                </template>
                <el-menu-item index="/index/wallet">我的钱包</el-menu-item>
              </el-sub-menu>
              <!-- 设置 -->
              <el-sub-menu index="5">
                <template #title>
                  <el-icon :size="22"><setting /></el-icon>
                  <span>设置</span>
                </template>
                <el-menu-item index="/index/system">系统设置</el-menu-item>
                <el-menu-item index="/index/account">账号设置</el-menu-item>
              </el-sub-menu>
            </el-menu>
          </el-col>
        </el-row>
      </el-scrollbar>
    </el-aside>

    <el-container>
      <!-- 头部组件 -->
      <el-header>
        <!-- 左边搜索区 -->
        <div class="left">
          <el-input
            v-model="input2"
            placeholder="请输入搜索内容"
            resize="horizontal"
          >
            <template #suffix>
              <el-button type="primary" round>搜索</el-button>
            </template>
            <template #prefix>
              <el-icon :size="22"><search /></el-icon>
            </template>
          </el-input>
        </div>
        <!-- 右边功能区 -->
        <div class="right">
          <img
            src="../../assets/images/刷新标志.png"
            alt=""
            @click="DataChange"
          />
          <span @click="DataChange">刷新</span>
          <img src="../../assets/images/通知标志.png" alt="" />
          <span>通知</span>
          <img src="../../assets/images/设置标志.png" alt="" />
          <span>设置</span>
          <div class="name">
            <span>您好,金凯瑞</span>
            <i>[<a href="">退出</a>]</i>
          </div>
          <!-- 头像 -->
          <el-avatar
            :size="35"
            src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
          ></el-avatar>
        </div>
      </el-header>
      <el-main><router-view></router-view></el-main>
    </el-container>
  </el-container>
</template>

<script>
import {
  ElContainer,
  ElHeader,
  ElAside,
  ElMain,
  ElCol,
  ElAvatar,
  ElMenu,
  ElSubMenu,
  ElIcon,
  ElMenuItem,
  ElRow,
  ElScrollbar,
  ElInput,
  ElButton,
} from "element-plus";
import {
  HomeFilled,
  Grid,
  Tickets,
  BellFilled,
  UserFilled,
  Setting,
  Search,
} from "@element-plus/icons-vue";
import { ref } from "vue";
import { useRouter } from "vue-router";
export default {
  setup() {
    const router = useRouter();
    const input2 = ref("");

    const DataChange = () => {
      router.go(0);
    };

    return {
      input2,
      DataChange,
    };
  },
  components: {
    ElContainer,
    ElHeader,
    ElAside,
    ElMain,
    ElCol,
    ElAvatar,
    ElMenu,
    ElSubMenu,
    ElIcon,
    ElMenuItem,
    ElRow,
    ElScrollbar,
    HomeFilled,
    Grid,
    Tickets,
    BellFilled,
    UserFilled,
    Setting,
    ElInput,
    Search,
    ElButton,
  },
};
</script>

<style lang="less" scoped>
.el-container {
  height: 100%;
}
.el-header {
  background: linear-gradient(to right, #005f7c, #232f62);
  color: #fff;
  line-height: 60px;
  height: 60px;
  position: relative;
  padding-left: 22px;
  display: flex;
  position: relative;
  min-width: 740px;
}
.el-aside {
  display: flex;
  flex-direction: column;
  width: 160px;
  background-color: #d3dce6;
  color: #fff;
  text-align: center;
  background: linear-gradient(to bottom, #005f7c, #232f62);
  .top {
    display: flex;
    width: 100%;
    height: 60px;
    justify-content: center;
    align-items: center;
    img {
      width: 35px;
      height: 32px;
      margin-left: 5px;
    }
    span {
      width: 144px;
      height: 25px;
      font-size: 17px;
      font-family: Microsoft YaHei;
      font-weight: bold;
      color: #ffffff;
      line-height: 35px;
    }
  }
}
.el-col-12 {
  flex: 0 30%;
  width: 160px;
  max-width: 100%;
  .block {
    height: 100%;
    span {
      margin-top: 20px;
    }
  }
}

.el-menu {
  width: 160px;
}
.el-aside {
  display: flex;
  flex-direction: column;
}
.bigBox {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.tac {
  margin-top: 20px;
}

// 头部css
.left {
  width: 394px;
  padding-left: 136px;
  /deep/.el-input__inner {
    border-radius: 24px;
  }
  /deep/.el-input__inner {
    text-align: right;
    padding-right: 70px;
  }

  /deep/.el-input__prefix {
    display: flex;
    justify-content: center;
    align-items: center;
  }
  /deep/.el-input__suffix {
    height: 100%;
    display: flex;
    align-items: center;
  }
  /deep/.el-button {
    background-color: #232f62;
    border-radius: 12px;
    height: 24px;
  }
  /deep/.el-input__suffix-inner {
    width: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
  }
}
.right {
  display: flex;
  align-items: center;
  position: absolute;
  right: 20px;

  img {
    width: 20px;
    height: 20px;
    margin-right: 3px;
  }
  span {
    margin-right: 10px;
    font-size: 12px;
  }
  .name {
    display: flex;
    flex-direction: column;
    align-items: center;
    span {
      line-height: 20px;
    }
    i {
      line-height: 10px;
      a {
        color: #00b7ee;
      }
    }
  }
}
</style>
